/**
 * Free software.
 */

package org.nanhill.commons.collection;

import java.util.Iterator;

public class IntArrayIterator implements Iterator {
	private int[] array;

	private int location;

	public void setArray(int[] array) {
		this.array = array;
		location = 0;
	}

	public IntArrayIterator(int[] array) {
		this.array = array;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#hasNext()
	 */
	public boolean hasNext() {
		return location < array.length;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#next()
	 */
	public Integer next() {
		int item =  array[location];
		location++;
		return item;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Iterator#remove()
	 */
	public void remove() {
		throw new UnsupportedOperationException(
				"This iterator unsupport remove operation.");

	}

}